package com.logistics.heart.entity.model;

import com.logistics.heart.entity.domain.Heart;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class HeartRow {

    private String id;

    private String ip;

    private String connectState;

    private String handleState;

    private Integer battery;

    private BigDecimal x;

    private BigDecimal y;

    private BigDecimal yaw;

    private String stage;

    private BigDecimal forkHeight;

    private String agvName;

    private String moveState;

    private String state;

    private String path;

    private String createTime;

    private String targetLocationId;

    public HeartRow(Heart heart){
        this.id = heart.getId().toString();
        this.ip = heart.getIp();
        this.connectState = heart.getConnectState();
        this.handleState = heart.getHandleState();
        this.battery = heart.getBattery();
        this.x = heart.getX();
        this.y = heart.getY();
        this.yaw = heart.getYaw();
        this.stage = heart.getStage();
        this.forkHeight = heart.getForkHeight();
        this.agvName = heart.getAgvName();
        this.moveState = heart.getMoveState();
        this.state = heart.getState();
        this.path = heart.getPath();
        this.createTime = DateUtils.dateToStringFormat(heart.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
    }

    public static HeartRow build(Heart heart){
        return new HeartRow(heart);
    }
}
